package com.lcz.mytest.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/*用户*/
public class DatabaseHelper extends SQLiteOpenHelper {

    static String name = "user.db";
    static int dbVersion = 1;

    public DatabaseHelper(Context context) {
        super(context, name, null, dbVersion);
    }

    //只在创建的时候用一次
    public void onCreate(SQLiteDatabase db) {
        //创建用户表
        String sql = "create table user(id integer primary key autoincrement,username varchar(20),password varchar(20))";
        //创建收藏表
        String sql2 = "create table collect(id integer primary key autoincrement,username varchar(20),stockcode varchar(20),datatype varchar(20))";
        db.execSQL(sql);
        db.execSQL(sql2);
    }

    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }

}
